package com.cskaoyan.mapper;

import com.cskaoyan.bean.MarketSearchHistory;
import com.cskaoyan.bean.MarketSearchHistoryExample;
import com.cskaoyan.bean.MarketUser;
import com.cskaoyan.bean.chenfeng.vo.SearchIndexVo;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;

public interface MarketSearchHistoryMapper {
    long countByExample(MarketSearchHistoryExample example);

    int deleteByExample(MarketSearchHistoryExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(MarketSearchHistory record);

    int insertSelective(MarketSearchHistory record);

    List<MarketSearchHistory> selectByExample(MarketSearchHistoryExample example);

    MarketSearchHistory selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") MarketSearchHistory record, @Param("example") MarketSearchHistoryExample example);

    int updateByExample(@Param("record") MarketSearchHistory record, @Param("example") MarketSearchHistoryExample example);

    int updateByPrimaryKeySelective(MarketSearchHistory record);

    int updateByPrimaryKey(MarketSearchHistory record);

    // 获取到用户输入的历史搜索词
    List<SearchIndexVo.SearchHistoryVo> selectByUserId(@Param("id") Integer id);

    // 根据用户的id隐藏其对应的历史搜索
    Integer updateDeletedToTrueByUserId(@Param("userId") Integer userId);

    // 查入历史搜索数据
    Integer insertSearchHistory(@Param("keyword") String keyword, @Param("userId") Integer userId);

    // 根据关键词和用户id查询关键词
    List<MarketSearchHistory> selectSearchHistoryByKeywordAndUserId(@Param("keyword") String keyword, @Param("userId") Integer userId);

    // 根据记录id更新时间
    Integer updateUptateTime(@Param("searchHistoryIdList") ArrayList<Integer> searchHistoryIdList);
}